#include<stdio.h>
#include<math.h>


int main(){
	int w,h,r,i,j;
	printf("Enter number of * in width and heiht must be >0:");
	scanf("%d%d",&w,&h);
	if(w<=0||h<=0)
	printf("wrong input both values must be >0");
	else{	
	for(i=1;i<=h;i++){
		if(i==1||i==h){
			for(j=1;j<=w;j++)
			printf("*");
		}else{
			printf("*");
			for(j=2;j<w;j++){
				printf(" ");
			}
			printf("*");
		}
		
	
		printf("\n");
	}
	
	}

	return 0;
}
